package com.apexedu.theme.action;

import com.apexedu.framework.service.BaseService;
import com.apexedu.sys.action.AbstractBaseActionSupport;
import com.apexedu.theme.entity.TXxfbZt;
import com.apexedu.theme.service.Impl.AucThemeManageServiceImpl;
import com.apexedu.util.StringUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.File;
import java.util.List;

/**
 * 门户主题管理
 * Created by 建 on 2015/4/7.
 * 主要实现主题包的上传、删除操作。
 */
@Component
@Scope("prototype")
public class AucThemeManageAction extends AbstractBaseActionSupport {

    @Resource(name = "aucThemeManageService")

    public void setBaseService(BaseService baseService){
        super.setBaseService(baseService);
    }

    private TXxfbZt xxfbZt;

    private File ztb;

    private String ztbContentType;

    private String ztbFileName;

    private List<TXxfbZt> ztList;//主题信息

    public List<TXxfbZt> getZtList() {
        return ztList;

    }

    public void setZtList(List<TXxfbZt> ztList) {
        this.ztList = ztList;
    }

    public TXxfbZt getXxfbZt() {
        return xxfbZt;
    }

    public void setXxfbZt(TXxfbZt xxfbZt) {
        this.xxfbZt = xxfbZt;
    }

    public File getZtb() {
        return ztb;
    }

    public void setZtb(File ztb) {
        this.ztb = ztb;
    }

    public String getZtbContentType() {
        return ztbContentType;
    }

    public void setZtbContentType(String ztbContentType) {
        this.ztbContentType = ztbContentType;
    }

    public String getZtbFileName() {
        return ztbFileName;
    }

    public void setZtbFileName(String ztbFileName) {
        this.ztbFileName = ztbFileName;
    }

    /**
     * 判断主题编码是否已经存在。
     */
    public void checked(){
        AucThemeManageServiceImpl service=(AucThemeManageServiceImpl)this.getBaseService();
        String info=service.checked(this);
        if(StringUtil.isNotBlank(info)){
            putResultStringToView("ok");
        }else{
            putResultStringToView("no");
        }
    }

}
